#include <iostream>
using namespace std;

class Base {
  public:
    Base(int a) {
      this->a = a;
    }
    ~Base() { cout << "~Base()" << endl; }
    virtual void func1() {
      cout << "a: " << a << endl;
      cout << "this->a: " << this->a << endl;
    }

  protected:
    int a;
};

class Derived : public Base {
  public:
    Derived(int baseA, int a): Base(baseA), a(a) {
      cout << "Derived::a: " << a << endl;
    }
    ~Derived() { cout << "~Derived()" << endl; }
    void func2() {
      cout << "[Derived::func2] Derived::a: " << a << endl;
      cout << "[Derived::func2] Base::a: " << Base::a << endl;
    }
  private:
    int a;
};

int main() {
  Derived d(100, 200);
  d.func1();
  d.func2();
  return 0;
}
